package cn.iocoder.mall.admin.mq;

import cn.iocoder.common.framework.constant.CommonConstant;
import cn.iocoder.common.utils.common.api.vo.SMSMQDTO;
import cn.iocoder.common.utils.common.util.json.JacksonUtils;
import cn.iocoder.mall.admin.client.SmsClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 商品收藏 消费者
 * @author yinxucun
 * @date  19.11.27
 * @version 1.0
 */
@Service
@Slf4j
@RocketMQMessageListener(topic = CommonConstant.SMS_ROCKET_VERIFY_CODE_TOPIC, consumerGroup = "mall_sms_consumer")
public class SmsSendVerificationCodeConsumer implements RocketMQListener<SMSMQDTO> {

    @Resource(name = "smsAliYunClient")
    SmsClient client;

    @Override
    public void onMessage(SMSMQDTO smsmqdto) {
        log.info("通过rockmq接收到了消息并进行发送\r"+ JacksonUtils.toJSONString(smsmqdto));
        //client.singleSendVerificationCode(smsmqdto.getMobile(),smsmqdto.getCode());
    }




}
